// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers.  See the top-level LICENSE file for dates and other
// details.  No copyright assignment is required to contribute to VisIt.

#include <PyAnimationAttributes.h>
#include <ObserverToCallback.h>
#include <stdio.h>
#include <Py2and3Support.h>

// ****************************************************************************
// Module: PyAnimationAttributes
//
// Purpose:
//   This class contains the animation attributes.
//
// Note:       Autogenerated by xml2python. Do not modify by hand!
//
// Programmer: xml2python
// Creation:   omitted
//
// ****************************************************************************

//
// This struct contains the Python type information and a AnimationAttributes.
//
struct AnimationAttributesObject
{
    PyObject_HEAD
    AnimationAttributes *data;
    bool        owns;
    PyObject   *parent;
};

//
// Internal prototypes
//
static PyObject *NewAnimationAttributes(int);
std::string
PyAnimationAttributes_ToString(const AnimationAttributes *atts, const char *prefix, const bool forLogging)
{
    std::string str;
    char tmpStr[1000];

    const char *animationMode_names = "ReversePlayMode, StopMode, PlayMode";
    switch (atts->GetAnimationMode())
    {
      case AnimationAttributes::ReversePlayMode:
          snprintf(tmpStr, 1000, "%sanimationMode = %sReversePlayMode  # %s\n", prefix, prefix, animationMode_names);
          str += tmpStr;
          break;
      case AnimationAttributes::StopMode:
          snprintf(tmpStr, 1000, "%sanimationMode = %sStopMode  # %s\n", prefix, prefix, animationMode_names);
          str += tmpStr;
          break;
      case AnimationAttributes::PlayMode:
          snprintf(tmpStr, 1000, "%sanimationMode = %sPlayMode  # %s\n", prefix, prefix, animationMode_names);
          str += tmpStr;
          break;
      default:
          break;
    }

    if(atts->GetPipelineCachingMode())
        snprintf(tmpStr, 1000, "%spipelineCachingMode = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%spipelineCachingMode = 0\n", prefix);
    str += tmpStr;
    snprintf(tmpStr, 1000, "%sframeIncrement = %d\n", prefix, atts->GetFrameIncrement());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%stimeout = %d\n", prefix, atts->GetTimeout());
    str += tmpStr;
    const char *playbackMode_names = "Looping, PlayOnce, Swing";
    switch (atts->GetPlaybackMode())
    {
      case AnimationAttributes::Looping:
          snprintf(tmpStr, 1000, "%splaybackMode = %sLooping  # %s\n", prefix, prefix, playbackMode_names);
          str += tmpStr;
          break;
      case AnimationAttributes::PlayOnce:
          snprintf(tmpStr, 1000, "%splaybackMode = %sPlayOnce  # %s\n", prefix, prefix, playbackMode_names);
          str += tmpStr;
          break;
      case AnimationAttributes::Swing:
          snprintf(tmpStr, 1000, "%splaybackMode = %sSwing  # %s\n", prefix, prefix, playbackMode_names);
          str += tmpStr;
          break;
      default:
          break;
    }

    return str;
}

static PyObject *
AnimationAttributes_Notify(PyObject *self, PyObject *args)
{
    AnimationAttributesObject *obj = (AnimationAttributesObject *)self;
    obj->data->Notify();
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
AnimationAttributes_SetAnimationMode(PyObject *self, PyObject *args)
{
    AnimationAttributesObject *obj = (AnimationAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if ((val == -1 && PyErr_Occurred()) || long(cval) != val)
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }

    if (cval < 0 || cval >= 3)
    {
        std::stringstream ss;
        ss << "An invalid animationMode value was given." << std::endl;
        ss << "Valid values are in the range [0,2]." << std::endl;
        ss << "You can also use the following symbolic names:";
        ss << " ReversePlayMode";
        ss << ", StopMode";
        ss << ", PlayMode";
        return PyErr_Format(PyExc_ValueError, ss.str().c_str());
    }

    Py_XDECREF(packaged_args);

    // Set the animationMode in the object.
    obj->data->SetAnimationMode(AnimationAttributes::AnimationMode(cval));

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
AnimationAttributes_GetAnimationMode(PyObject *self, PyObject *args)
{
    AnimationAttributesObject *obj = (AnimationAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetAnimationMode()));
    return retval;
}

/*static*/ PyObject *
AnimationAttributes_SetPipelineCachingMode(PyObject *self, PyObject *args)
{
    AnimationAttributesObject *obj = (AnimationAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the pipelineCachingMode in the object.
    obj->data->SetPipelineCachingMode(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
AnimationAttributes_GetPipelineCachingMode(PyObject *self, PyObject *args)
{
    AnimationAttributesObject *obj = (AnimationAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetPipelineCachingMode()?1L:0L);
    return retval;
}

/*static*/ PyObject *
AnimationAttributes_SetFrameIncrement(PyObject *self, PyObject *args)
{
    AnimationAttributesObject *obj = (AnimationAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ int");
    }

    Py_XDECREF(packaged_args);

    // Set the frameIncrement in the object.
    obj->data->SetFrameIncrement(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
AnimationAttributes_GetFrameIncrement(PyObject *self, PyObject *args)
{
    AnimationAttributesObject *obj = (AnimationAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetFrameIncrement()));
    return retval;
}

/*static*/ PyObject *
AnimationAttributes_SetTimeout(PyObject *self, PyObject *args)
{
    AnimationAttributesObject *obj = (AnimationAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ int");
    }

    Py_XDECREF(packaged_args);

    // Set the timeout in the object.
    obj->data->SetTimeout(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
AnimationAttributes_GetTimeout(PyObject *self, PyObject *args)
{
    AnimationAttributesObject *obj = (AnimationAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetTimeout()));
    return retval;
}

/*static*/ PyObject *
AnimationAttributes_SetPlaybackMode(PyObject *self, PyObject *args)
{
    AnimationAttributesObject *obj = (AnimationAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if ((val == -1 && PyErr_Occurred()) || long(cval) != val)
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }

    if (cval < 0 || cval >= 3)
    {
        std::stringstream ss;
        ss << "An invalid playbackMode value was given." << std::endl;
        ss << "Valid values are in the range [0,2]." << std::endl;
        ss << "You can also use the following symbolic names:";
        ss << " Looping";
        ss << ", PlayOnce";
        ss << ", Swing";
        return PyErr_Format(PyExc_ValueError, ss.str().c_str());
    }

    Py_XDECREF(packaged_args);

    // Set the playbackMode in the object.
    obj->data->SetPlaybackMode(AnimationAttributes::PlaybackMode(cval));

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
AnimationAttributes_GetPlaybackMode(PyObject *self, PyObject *args)
{
    AnimationAttributesObject *obj = (AnimationAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetPlaybackMode()));
    return retval;
}



PyMethodDef PyAnimationAttributes_methods[ANIMATIONATTRIBUTES_NMETH] = {
    {"Notify", AnimationAttributes_Notify, METH_VARARGS},
    {"SetAnimationMode", AnimationAttributes_SetAnimationMode, METH_VARARGS},
    {"GetAnimationMode", AnimationAttributes_GetAnimationMode, METH_VARARGS},
    {"SetPipelineCachingMode", AnimationAttributes_SetPipelineCachingMode, METH_VARARGS},
    {"GetPipelineCachingMode", AnimationAttributes_GetPipelineCachingMode, METH_VARARGS},
    {"SetFrameIncrement", AnimationAttributes_SetFrameIncrement, METH_VARARGS},
    {"GetFrameIncrement", AnimationAttributes_GetFrameIncrement, METH_VARARGS},
    {"SetTimeout", AnimationAttributes_SetTimeout, METH_VARARGS},
    {"GetTimeout", AnimationAttributes_GetTimeout, METH_VARARGS},
    {"SetPlaybackMode", AnimationAttributes_SetPlaybackMode, METH_VARARGS},
    {"GetPlaybackMode", AnimationAttributes_GetPlaybackMode, METH_VARARGS},
    {NULL, NULL}
};

//
// Type functions
//

static void
AnimationAttributes_dealloc(PyObject *v)
{
   AnimationAttributesObject *obj = (AnimationAttributesObject *)v;
   if(obj->parent != 0)
       Py_DECREF(obj->parent);
   if(obj->owns)
       delete obj->data;
}

static PyObject *AnimationAttributes_richcompare(PyObject *self, PyObject *other, int op);
PyObject *
PyAnimationAttributes_getattr(PyObject *self, char *name)
{
    if(strcmp(name, "animationMode") == 0)
        return AnimationAttributes_GetAnimationMode(self, NULL);
    if(strcmp(name, "ReversePlayMode") == 0)
        return PyInt_FromLong(long(AnimationAttributes::ReversePlayMode));
    if(strcmp(name, "StopMode") == 0)
        return PyInt_FromLong(long(AnimationAttributes::StopMode));
    if(strcmp(name, "PlayMode") == 0)
        return PyInt_FromLong(long(AnimationAttributes::PlayMode));

    if(strcmp(name, "pipelineCachingMode") == 0)
        return AnimationAttributes_GetPipelineCachingMode(self, NULL);
    if(strcmp(name, "frameIncrement") == 0)
        return AnimationAttributes_GetFrameIncrement(self, NULL);
    if(strcmp(name, "timeout") == 0)
        return AnimationAttributes_GetTimeout(self, NULL);
    if(strcmp(name, "playbackMode") == 0)
        return AnimationAttributes_GetPlaybackMode(self, NULL);
    if(strcmp(name, "Looping") == 0)
        return PyInt_FromLong(long(AnimationAttributes::Looping));
    if(strcmp(name, "PlayOnce") == 0)
        return PyInt_FromLong(long(AnimationAttributes::PlayOnce));
    if(strcmp(name, "Swing") == 0)
        return PyInt_FromLong(long(AnimationAttributes::Swing));



    // Add a __dict__ answer so that dir() works
    if (!strcmp(name, "__dict__"))
    {
        PyObject *result = PyDict_New();
        for (int i = 0; PyAnimationAttributes_methods[i].ml_meth; i++)
            PyDict_SetItem(result,
                PyString_FromString(PyAnimationAttributes_methods[i].ml_name),
                PyString_FromString(PyAnimationAttributes_methods[i].ml_name));
        return result;
    }

    return Py_FindMethod(PyAnimationAttributes_methods, self, name);
}

int
PyAnimationAttributes_setattr(PyObject *self, char *name, PyObject *args)
{
    PyObject NULL_PY_OBJ;
    PyObject *obj = &NULL_PY_OBJ;

    if(strcmp(name, "animationMode") == 0)
        obj = AnimationAttributes_SetAnimationMode(self, args);
    else if(strcmp(name, "pipelineCachingMode") == 0)
        obj = AnimationAttributes_SetPipelineCachingMode(self, args);
    else if(strcmp(name, "frameIncrement") == 0)
        obj = AnimationAttributes_SetFrameIncrement(self, args);
    else if(strcmp(name, "timeout") == 0)
        obj = AnimationAttributes_SetTimeout(self, args);
    else if(strcmp(name, "playbackMode") == 0)
        obj = AnimationAttributes_SetPlaybackMode(self, args);

    if (obj != NULL && obj != &NULL_PY_OBJ)
        Py_DECREF(obj);

    if (obj == &NULL_PY_OBJ)
    {
        obj = NULL;
        PyErr_Format(PyExc_NameError, "name '%s' is not defined", name);
    }
    else if (obj == NULL && !PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "unknown problem with '%s'", name);

    return (obj != NULL) ? 0 : -1;
}

static int
AnimationAttributes_print(PyObject *v, FILE *fp, int flags)
{
    AnimationAttributesObject *obj = (AnimationAttributesObject *)v;
    fprintf(fp, "%s", PyAnimationAttributes_ToString(obj->data, "",false).c_str());
    return 0;
}

PyObject *
AnimationAttributes_str(PyObject *v)
{
    AnimationAttributesObject *obj = (AnimationAttributesObject *)v;
    return PyString_FromString(PyAnimationAttributes_ToString(obj->data,"", false).c_str());
}

//
// The doc string for the class.
//
#if PY_MAJOR_VERSION > 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 5)
static const char *AnimationAttributes_Purpose = "This class contains the animation attributes.";
#else
static char *AnimationAttributes_Purpose = "This class contains the animation attributes.";
#endif

//
// Python Type Struct Def Macro from Py2and3Support.h
//
//         VISIT_PY_TYPE_OBJ( VPY_TYPE,
//                            VPY_NAME,
//                            VPY_OBJECT,
//                            VPY_DEALLOC,
//                            VPY_PRINT,
//                            VPY_GETATTR,
//                            VPY_SETATTR,
//                            VPY_STR,
//                            VPY_PURPOSE,
//                            VPY_RICHCOMP,
//                            VPY_AS_NUMBER)

//
// The type description structure
//

VISIT_PY_TYPE_OBJ(AnimationAttributesType,         \
                  "AnimationAttributes",           \
                  AnimationAttributesObject,       \
                  AnimationAttributes_dealloc,     \
                  AnimationAttributes_print,       \
                  PyAnimationAttributes_getattr,   \
                  PyAnimationAttributes_setattr,   \
                  AnimationAttributes_str,         \
                  AnimationAttributes_Purpose,     \
                  AnimationAttributes_richcompare, \
                  0); /* as_number*/

//
// Helper function for comparing.
//
static PyObject *
AnimationAttributes_richcompare(PyObject *self, PyObject *other, int op)
{
    // only compare against the same type 
    if ( Py_TYPE(self) != &AnimationAttributesType
         || Py_TYPE(other) != &AnimationAttributesType)
    {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }

    PyObject *res = NULL;
    AnimationAttributes *a = ((AnimationAttributesObject *)self)->data;
    AnimationAttributes *b = ((AnimationAttributesObject *)other)->data;

    switch (op)
    {
       case Py_EQ:
           res = (*a == *b) ? Py_True : Py_False;
           break;
       case Py_NE:
           res = (*a != *b) ? Py_True : Py_False;
           break;
       default:
           res = Py_NotImplemented;
           break;
    }

    Py_INCREF(res);
    return res;
}

//
// Helper functions for object allocation.
//

static AnimationAttributes *defaultAtts = 0;
static AnimationAttributes *currentAtts = 0;

static PyObject *
NewAnimationAttributes(int useCurrent)
{
    AnimationAttributesObject *newObject;
    newObject = PyObject_NEW(AnimationAttributesObject, &AnimationAttributesType);
    if(newObject == NULL)
        return NULL;
    if(useCurrent && currentAtts != 0)
        newObject->data = new AnimationAttributes(*currentAtts);
    else if(defaultAtts != 0)
        newObject->data = new AnimationAttributes(*defaultAtts);
    else
        newObject->data = new AnimationAttributes;
    newObject->owns = true;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

static PyObject *
WrapAnimationAttributes(const AnimationAttributes *attr)
{
    AnimationAttributesObject *newObject;
    newObject = PyObject_NEW(AnimationAttributesObject, &AnimationAttributesType);
    if(newObject == NULL)
        return NULL;
    newObject->data = (AnimationAttributes *)attr;
    newObject->owns = false;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

///////////////////////////////////////////////////////////////////////////////
//
// Interface that is exposed to the VisIt module.
//
///////////////////////////////////////////////////////////////////////////////

PyObject *
AnimationAttributes_new(PyObject *self, PyObject *args)
{
    int useCurrent = 0;
    if (!PyArg_ParseTuple(args, "i", &useCurrent))
    {
        if (!PyArg_ParseTuple(args, ""))
            return NULL;
        else
            PyErr_Clear();
    }

    return (PyObject *)NewAnimationAttributes(useCurrent);
}

//
// Plugin method table. These methods are added to the visitmodule's methods.
//
static PyMethodDef AnimationAttributesMethods[] = {
    {"AnimationAttributes", AnimationAttributes_new, METH_VARARGS},
    {NULL,      NULL}        /* Sentinel */
};

static Observer *AnimationAttributesObserver = 0;

std::string
PyAnimationAttributes_GetLogString()
{
    std::string s("AnimationAtts = AnimationAttributes()\n");
    if(currentAtts != 0)
        s += PyAnimationAttributes_ToString(currentAtts, "AnimationAtts.", true);
    return s;
}

static void
PyAnimationAttributes_CallLogRoutine(Subject *subj, void *data)
{
    typedef void (*logCallback)(const std::string &);
    logCallback cb = (logCallback)data;

    if(cb != 0)
    {
        std::string s("AnimationAtts = AnimationAttributes()\n");
        s += PyAnimationAttributes_ToString(currentAtts, "AnimationAtts.", true);
        cb(s);
    }
}

void
PyAnimationAttributes_StartUp(AnimationAttributes *subj, void *data)
{
    if(subj == 0)
        return;

    currentAtts = subj;
    PyAnimationAttributes_SetDefaults(subj);

    //
    // Create the observer that will be notified when the attributes change.
    //
    if(AnimationAttributesObserver == 0)
    {
        AnimationAttributesObserver = new ObserverToCallback(subj,
            PyAnimationAttributes_CallLogRoutine, (void *)data);
    }

}

void
PyAnimationAttributes_CloseDown()
{
    delete defaultAtts;
    defaultAtts = 0;
    delete AnimationAttributesObserver;
    AnimationAttributesObserver = 0;
}

PyMethodDef *
PyAnimationAttributes_GetMethodTable(int *nMethods)
{
    *nMethods = 1;
    return AnimationAttributesMethods;
}

bool
PyAnimationAttributes_Check(PyObject *obj)
{
    return (obj->ob_type == &AnimationAttributesType);
}

AnimationAttributes *
PyAnimationAttributes_FromPyObject(PyObject *obj)
{
    AnimationAttributesObject *obj2 = (AnimationAttributesObject *)obj;
    return obj2->data;
}

PyObject *
PyAnimationAttributes_New()
{
    return NewAnimationAttributes(0);
}

PyObject *
PyAnimationAttributes_Wrap(const AnimationAttributes *attr)
{
    return WrapAnimationAttributes(attr);
}

void
PyAnimationAttributes_SetParent(PyObject *obj, PyObject *parent)
{
    AnimationAttributesObject *obj2 = (AnimationAttributesObject *)obj;
    obj2->parent = parent;
}

void
PyAnimationAttributes_SetDefaults(const AnimationAttributes *atts)
{
    if(defaultAtts)
        delete defaultAtts;

    defaultAtts = new AnimationAttributes(*atts);
}

